var QQMapWX = require('../../lib/qqmap-wx-jssdk.js');
var utils = require('../../utils/utils.js');
var region = "";
var longitude;
var latitude;
var star = '';
var tel = '';
var content = '';
var team = '巴西';
//获取应用实例
var app = getApp()
Page({
  data: {
    array: ['巴西', '德国', '西班牙', '意大利', '阿根廷'],
    index: 0,
    star: '',
    content: '',
    tel: ''
  },

  bindPickerChange: function (e) {
    this.setData({
      index: e.detail.value
    })
    console.log(this.data.array[e.detail.value]);
    team = this.data.array[e.detail.value]
  },
  getstar: function (e) {
    star = e.detail.value
  },
  gettel: function (e) {
    tel = e.detail.value
  },
  // 获取内容
  getcontent: function (e) {
    content = e.detail.value
  },
  bindCancel: function () {
    wx.navigateBack({})
  },
  // 上传
  bindSave: function (e) {
    var info = wx.getStorageSync('userinfo');
    var use = wx.getStorageSync('use');
    var that = this;
    if (star==''){
      wx.showToast({
        title: '喜爱的球星为空',
      })
      return;
    }
    if (content == "") {
      wx.showToast({
        title: '介绍自己为空',
      })
      return;

    } else if (content.length > 400) {
      wx.showToast({
        title: '介绍自己不超过200字'
      })
      return;
    }else{
      wx.request({
        url: app.globalData.url+'infoPerfection/', //仅为示例，并非真实的接口地址
        data: {
          name: info.nickName,
          wxid: '',
          phone: tel,
          resume: content,
          team: team,
          star: star,
          openid: use.openid
        },
        method: "POST",
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: function (res) {
          console.log(res);
          wx.showLoading({
            title: '上传成功',
          })
          setTimeout(function () {
            wx.hideLoading()
          }, 1000)
          that.del();
        }
      })
    }
   

  },
  // 删除input中的内容
  del: function () {
    star = '';
    tel = '';
    content = '';
    this.setData({ star: star, tel: tel, content: content })
  },
  // 取消
  bindCancel: function (e) {
    wx.navigateBack();

  },





  onLoad: function (e) {


  }


})



